#pragma once

#include<iostream>
#include<vector>
using namespace std;
typedef void(*fuc_t)();
#define COMMEND_PRINTLOG 0;
#define COMMEND_INSERTMYSQL 1;
#define COMMEND_NETREQUEST 2;
void PrintLog()
{
    std::cout<< "pid: "<< getpid()<<"这是一个打印日志的任务"<<endl;
}

void InsertMySQL()
{
    std::cout<<"pid: "<< getpid()<<"这是一个插入数据库的任务"<<endl;
}

void NetRequest()
{
    std::cout<<"pid: "<< getpid()<<"这是一个网络请求的任务"<<endl;
}

class Task
{
public:
    Task()
    {
        _fucs.push_back(PrintLog);
        _fucs.push_back(InsertMySQL);
        _fucs.push_back(NetRequest);

    };
    void Execute(int commend)
    {
        if(commend>=0&&commend<_fucs.size())
        {
            _fucs[commend]();
        }
    }
    ~Task()
    {

    }
public:
    vector<fuc_t> _fucs;
};